<h1>Liste des médias</h1>
<div class="columns ten">
    <div align="right">
        <a class="pwe-ui-btn" href="javascript:openAddMedia(<?php echo (isset($data['id']))?$data['id']:0; ?>,'');">Ajouter</a>
            
    </div><br/>
    <table id="liste_media" class="liste ui-widget table_sortable" width="100%">
        <thead class="ui-widget-header">
            <tr>
                <th></th>
                <th>Titre</th>
                <th>Lien</th>
                <th width="150">Aperçu</th>
                <th>Légende</th>
                <th>Actions</th>
            </tr>
        </thead>
        <tbody>
        <?php foreach(modele_media::getListe() as $idx=>$media): ?>
            <tr>
                <td><?php echo $idx; ?></td>
                <td>
                    <span><?php echo $media->getTitle(); ?></span><br/>
                </td>
                <td><?php echo $media->getUrl('../'); ?></td>
                <td>
                    <?php if($media->getMediaTypeId()==1): ?><img src="<?php echo $media->getUrl('../'); ?>" width="120px" title="<?php echo $media->getTitle(); ?>" alt="<?php echo $media->getTitle(); ?>" />
                    <?php elseif($media->getMediaTypeId()==2): ?><img src="<?php echo PWE::getBaseURL().'admin/css/gfx/logoPdf.png'; ?>" width="50px" title="<?php echo $media->getTitle(); ?>" alt="<?php echo $media->getTitle(); ?>" />
                    <?php endif; ?>
                </td>
                <td><?php echo $media->getLegende(); ?></td>
                <td>
                    <a class="pwe-ui-btn" href="<?php echo $media->getUrl('../'); ?>" target="preview_site" title="Voir"><span class="ui-icon ui-icon-extlink"></span></a>
                    <a class="pwe-ui-btn" href="javascript:openUpdateMedia(0,<?php echo $media->getId(); ?>,'');" title="Modifier"><span class="ui-icon ui-icon-pencil"></span></a>
                    <a href="javascript:removeMedia(0,<?php echo $media->getId(); ?>,'');" class="confirmAction pwe-ui-btn" title="Supprimer le media '<?php echo $media->getTitle(); ?>'"><span class="ui-icon ui-icon-trash"></span></a>
                </td>
            </tr>
        <?php endforeach; ?>
        </tbody>
    </table>
</div>